/*******************************************************************
* Author	: wwyang
* Date		: 2006.6.13
* Copyright : State key CAD&CG Lab, Group of Animation 
* Head File : Structure for manageing command
* Note      : This structure is taken from a project that i finished
in March, 2006
* Version   : 1.0
*********************************************************************/

#ifndef _COMMANDMANGE_H_
#define _COMMANDMANGE_H_
#pragma warning(disable: 4995)

#include <list> // For list


#include "BaseCommand.h" // For base class of command
#include "TestCmd.h" // For test command

/*
#include "TriangulatePointCloudCmd.h" // For point cloud triangulation command
#include "IntersectPointCloudMesh.h"  // For intersecting point cloud meshes command
*/
////////////////////////////////////////////////////////////////////////// 
// Transform operation switch for view

void SetTransformState(bool bTransformSwitch);
bool GetTransformState();

//////////////////////////////////////////////////////////////////////////
// Command objects' factory to manage all commands
// Each command class should be added an instance in the factory

class CCmdFactory{
	// macro type
public:
	typedef std::list<CCmdBase*> CmdList;

	friend class CCmdBase;
	// constructor & destructor
public:
	CCmdFactory(){}
	~CCmdFactory(){}

	// get objects
public:
	static CTestCmd& GetTestCmd()
	{ return _testCmd; }

	/*
	static CTriPointCloudCmd& GetPointCloudTriangulationCmd()
	{ return _pointCloudTriCmd; }
	static CIntersectPointCloudMeshCmd& GetPointCloudMeshIntersectionCmd()
	{ return _pointCloudMeshInterCmd; }
	*/

	// utility functions for command
private:
	static void AddToLiveList(CCmdBase *pCmd);
	static void DelLiveCmd(CCmdBase *pCmd);
	static CmdList::iterator FindCmdInLiveList(CCmdBase *pCmd);

	// utility functions for user
public:
	static void PassMsgToLiveCmd(CMsg& msg);
	static void StopAllLiveCmd();

private:
	static CmdList _liveCmdList; // live commands list

	// global command objects 
private:
	static CTestCmd _testCmd;

	/*
	static CTriPointCloudCmd _pointCloudTriCmd;
	static CIntersectPointCloudMeshCmd _pointCloudMeshInterCmd;
	*/

};


#endif